<template>
	<el-card class="form-container">
		<el-form :model="editForm" ref="editForm" :rules="dataRule" @keyup.enter.native="dataFormSubmitHandle()" label-width="90px">
			<el-form-item label="模块编号(英文标记)" prop="moduleCode">
				<el-input v-model="editForm.moduleCode" placeholder="请输入模块编号(英文标记)"></el-input>
			</el-form-item>
			<el-form-item label="模块名称(中文标记)" prop="moduleName">
				<el-input v-model="editForm.moduleName" placeholder="请输入模块名称(中文标记)"></el-input>
			</el-form-item>
			<el-form-item label="创建时间" prop="createTime">
				<el-input v-model="editForm.createTime" placeholder="请输入创建时间"></el-input>
			</el-form-item>
			<el-form-item label="修改时间" prop="updateTime">
				<el-input v-model="editForm.updateTime" placeholder="请输入修改时间"></el-input>
			</el-form-item>
			<el-form-item>
				<el-button @click="cancel">取消</el-button>
				<el-button type="primary" @click="update('editForm')">确定</el-button>
			</el-form-item>
		</el-form>
	</el-card>
</template>

<script>
	import { findMessageModuleDetail,editMessageModule } from '@/api/platform/message'
	export default {
		name: 'user-messageModule',
		data() {
			return {
				editForm: {
					id:'',
					moduleCode: '',
					moduleName: '',
				}
			}
		},
		created() {
			this.editForm.id = this.$route.query.id
			this.view(this.$route.query.id)
		},
		methods: {
			view(val) {
				findMessageModuleDetail(val).then(res => {
					this.editForm = res.data.responseData
				})
			},
			cancel() {
				this.$router.go(-1)
			},
			update() {
				const set = this.$refs;
				set['editForm'].validate((valid) => {
					if (!valid) {
						return false
					}
					editMessageModule(this.editForm).then(() => {
						this.$notify({
							title: '修改成功',
							message: '修改成功',
							type: 'success',
							duration: 2000,
							onClose: this.$router.go(-1)
						})
					})
				})
			}
		}
	}
</script>

<style>
</style>
